import request from "@/request/request"
import requestMock from "@/request/requestMock"
//1.三级分类列表的请求
export const reqCategoryList = () => {
  return request.get(`/product/getBaseCategoryList`)
}

//2.mock数据的请求--banner的列表
export const reqBannerList = () => {
  return requestMock.get("/banner/list")
}

//3. 请求floor的列表(MOCK请求)
export const reqFloorList = () => {
  return requestMock.get("/floor/list")
}

//4.请求搜索页面的列表数据
export const reqSearchList = (searchParams) => {
  return request.post(`/list`, searchParams)
}

//5.请求详情页商品的数据
export const reqDetailInfo = (skuId) => {
  return request.get(`/item/${skuId}`)
}

//6.请求详情页中已经选择完毕的商品的数据
export const reqAddCartSuccess = (skuId, skuNum) => {
  return request.post(`/cart/addToCart/${skuId}/${skuNum}`)
}

//7.请求购物车页面中的所有商品列表数据
export const reqShopCartList = () => {
  return request.get(`/cart/cartList`)
}

//8.请求购物车页面点击单个商品的数据
export const reqSingleGoods = (skuID, isChecked) => {
  return request.get(`/cart/checkCart/${skuID}/${isChecked}`)
}

//9.删除单个购物车商品的请求
export const reqDeleteSingleGoods = (skuId) => {
  return request.delete(`/cart/deleteCart/${skuId}`)
}
//10.控制购物车所有商品的状态（全选和反选）
export const reqAllChecked = (isChecked, skuIdList) => {
  return request.post(`/cart/batchCheckCart/${isChecked}`, skuIdList)
}
//11.批量删除购物车数据
export const reqDeleteAllChecked = (skuIdList) => {
  return request.delete(`/cart/batchDeleteCart`, {
    data: skuIdList,
  })
}

//12.获取注册验证码的请求
export const reqVerifyCode = (phone) => {
  return request.get(`/user/passport/sendCode/${phone}`)
}

//13.注册账号的请求
export const reqRegister = (userInfo) => {
  return request.post(`/user/passport/register`, userInfo)
}

//14.登录请求
export const reqLogin = (userInfo) => {
  return request.post(`/user/passport/login`, userInfo)
}

//15.请求用户信息
export const reqUserInfo = () => {
  return request.get(`/user/passport/auth/getUserInfo`)
}

//16.退出登录请求
export const reqLogout = () => {
  return request.get(`/user/passport/logout`)
}

//17.请求用户地址
export const reqUserAddress = () => {
  return requestMock.get(`/address/list`)
}

//18.请求交易页的信息
export const reqTradeInfo = () => {
  return request.get(`/order/auth/trade`)
}

//19.提交订单请求
export const reqSubmitOrder = (tradeNo, orderInfo) => {
  return request.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`, orderInfo)
}

//20.获取支付详情
export const reqPayInfo = (orderId) => {
  return request.get(`/payment/weixin/createNative/${orderId}`)
}

//21.支付成功的请求
export const reqPaySuccess = (orderId) => {
  return request.get(`/payment/weixin/queryPayStatus/${orderId}`)
}

//22.请求订单列表数据
export const reqOrderList = (page, limit) => {
  return request.get(`/order/auth/${page}/${limit}`)
}
